import json
data =[
    {
        "name": "紫嫣",
        "age:": 20,
        "sex": "女孩"
    },
    {
        "name": "嫣然",
        "age:": 22,
        "sex": "女孩"
    },
    {
        "name": "一萌",
        "age:": 22,
        "sex": "女孩"
    }
]
# 转换为json字符串
print("-" * 50, "转换为json字符串", "-" * 50)
# 增加缩进关系
str_json = json.dumps(data, ensure_ascii=False, indent=2)
print(str_json)

# json字符串转化为字典
print("-" * 50, "json字符串转化为字典", "-" * 50)
info = json.loads(str_json)
print(info)
print("取出某个元素：", info[2].get("name"))